<template>
	<view class="dingdan-container">
		<view class="kuang">
			<image class="bj" src="/static/图层 1@3x.png" mode=""></image>
			<view class="nav-bar">
				<view class="nav-left" @click="goBack">
					<uni-icons type="left" size="20" color="#ffffff"></uni-icons>
				</view>
				<text class="title">订单管理</text>
				<view class="nav-right">
					<view class="header-icon">
						<text>⋯</text>
					</view>
					<text class="nav-separator">|</text>
					<view class="header-icon">
						<view class="target-icon"></view>
					</view>
				</view>
			</view>
			
			<!-- 搜索栏 -->
			<view class="search-section">
				<view class="search-bar">
					<input class="search-input" v-model="searchText" placeholder="输入需要搜索的内容" placeholder-style="color: #999;" />
					<view class="search-icon-wrapper">
						<uni-icons type="search" size="20" color="#ffffff"></uni-icons>
					</view>
				</view>
			</view>
			
			<!-- 筛选栏 -->
			<view class="filter-bar">
				<text class="filter-text">共{{ orders.length }}条</text>
				<view class="filter-select" @click="showFilter = !showFilter">
					<text>待服务</text>
					<image class="arrow-icon" src="/static/车联网服务商家端-05订单管理_slices/收起箭头小@3x.png" mode="aspectFit"></image>
				</view>
			</view>
		</view>
		
		<!-- 订单列表 -->
		<scroll-view class="order-scroll" scroll-y>
			<view class="scroll-content">
				<view class="order-card" v-for="(item, index) in orders" :key="index">
					<view class="order-header">
						<text class="order-number">订单号: {{ item.orderNumber }}</text>
						<text class="order-price">¥{{ item.price }}</text>
					</view>
					<text class="order-item">下单用户: {{ item.user }}</text>
					<text class="order-item">预约时间: {{ item.appointmentTime }}</text>
					<text class="order-item">服务项目: {{ item.serviceItems }}</text>
					<text class="order-item">下单时间: {{ item.orderTime }}</text>
					<button class="detail-btn" @click="viewDetail(item)">查看详情</button>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				searchText: '',
				showFilter: false,
				orders: [
					{
						orderNumber: '2021010831213',
						price: '500',
						user: '张三丰',
						appointmentTime: '2023-03-10 11:00',
						serviceItems: '宝马X5加装轮、清洁车辆、汽车美容',
						orderTime: '2022-10-12 11:09'
					},
					{
						orderNumber: '2021010831213',
						price: '500',
						user: '张三丰',
						appointmentTime: '2023-03-10 11:00',
						serviceItems: '宝马X5加装轮、清洁车辆、汽车美容',
						orderTime: '2022-10-12 11:09'
					},
					{
						orderNumber: '2021010831213',
						price: '500',
						user: '张三丰',
						appointmentTime: '2023-03-10 11:00',
						serviceItems: '宝马X5加装轮、清洁车辆、汽车美容',
						orderTime: '2022-10-12 11:09'
					}
				]
			}
		},
		methods: {
			goBack() {
				uni.navigateBack()
			},
			viewDetail(item) {
				// TODO: 跳转到订单详情
				uni.showToast({
					title: '查看详情',
					icon: 'none'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.dingdan-container {
		min-height: 100vh;
		width: 100%;
		position: relative;
		background-color: #f5f5f5;
	}

	.bj {
		position: absolute;
		z-index: 1;
		width: 750rpx;
		height: 430rpx;
		left: 0;
		top: 0;
	}

	.kuang {
		display: flex;
		flex-direction: column;
		position: relative;
		width: 100%;
		height: 430rpx;
	}

	.nav-bar {
		position: relative;
		z-index: 2;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx 30rpx;
		margin-top: 60rpx;
		height: 88rpx;
		box-sizing: border-box;
	}

	.nav-left {
		width: 40rpx;
		height: 40rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: white;
		font-weight: bold;
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
	}

	.nav-right {
		display: flex;
		align-items: center;
	}

	.nav-right > view {
		margin-right: 10rpx;
	}

	.nav-right > view:last-child {
		margin-right: 0;
	}

	.nav-separator {
		color: rgba(255, 255, 255, 0.5);
		font-size: 20rpx;
		margin: 0 8rpx;
	}
	
	.header-icon {
		width: 48rpx;
		height: 48rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		
		text {
			color: #fff;
			font-size: 32rpx;
			line-height: 1;
		}
	}
	
	.target-icon {
		width: 24rpx;
		height: 24rpx;
		border: 2rpx solid #fff;
		border-radius: 50%;
		position: relative;
		
		&::after {
			content: '';
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			width: 8rpx;
			height: 8rpx;
			background: #fff;
			border-radius: 50%;
		}
	}

	/* 搜索区域 */
	.search-section {
		position: relative;
		z-index: 2;
		padding: 20rpx 30rpx;
		margin-top: 20rpx;
	}

	.search-bar {
		display: flex;
		align-items: center;
		background-color: #ffffff;
		border-radius: 50rpx;
		padding: 20rpx 24rpx;
		overflow: hidden;
	}

	.search-input {
		flex: 1;
		font-size: 28rpx;
		color: #333;
		background-color: transparent;
	}

	.search-icon-wrapper {
		margin-left: 15rpx;
		width: 48rpx;
		height: 48rpx;
		background: #007aff;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.filter-bar {
		position: relative;
		z-index: 2;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 30rpx;
		margin-top: 20rpx;
	}
	
	.filter-text {
		font-size: 28rpx;
		color: #fff;
	}
	
	.filter-select {
		display: flex;
		align-items: center;
		gap: 8rpx;
		font-size: 28rpx;
		color: #fff;
	}
	
	.arrow-icon {
		width: 24rpx;
		height: 24rpx;
		transform: rotate(180deg);
	}
	
	.order-scroll {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 1;
		overflow-y: auto;
		background: transparent;
	}
	
	.scroll-content {
		padding: 430rpx 20rpx 40rpx 20rpx;
	}
	
	.order-card {
		background: #fff;
		border-radius: 16rpx;
		padding: 30rpx;
		margin: 0 10rpx 20rpx 10rpx;
		box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
		position: relative;
		
		&:first-child {
			margin-top: -100rpx;
		}
	}
	
	.order-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20rpx;
	}
	
	.order-number {
		font-size: 28rpx;
		color: #333;
	}
	
	.order-price {
		font-size: 32rpx;
		font-weight: 500;
		color: #ff9500;
	}
	
	.order-item {
		display: block;
		font-size: 26rpx;
		color: #666;
		margin-bottom: 12rpx;
	}
	
	.detail-btn {
		position: absolute;
		bottom: 30rpx;
		right: 30rpx;
		width: 160rpx;
		height: 60rpx;
		line-height: 60rpx;
		background: #007aff;
		color: #fff;
		border: none;
		border-radius: 30rpx;
		font-size: 26rpx;
		
		&::after {
			border: none;
		}
	}
</style>

